package com.team.mp.api.controller;

import com.team.mp.api.bo.ServiceSearchBo;
import com.team.mp.api.bo.ServiceinfoSearchBo;
import com.team.mp.api.service.intf.ServiceinfoService;
import com.team.mp.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.team.mp.api.bo.ServiceinfoAddBo;
import com.team.mp.api.bo.ServiceinfoUpdateBo;
import com.team.mp.api.service.intf.ServiceinfoService;
import com.team.mp.mapper.entity.Serviceinfo;
import com.team.mp.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 千锋郑州Java学科欢迎你
 * @program: tproject
 * @description: 控制层实现常用的外部接口
 * @author: L2Y
 * @create: 2023-03-27 19:15:29
 */
@RestController
@RequestMapping("/api/serviceinfo/")
@Api(tags = "实现服务信息的操作")
public class ServiceinfoController{
    /**
    * 注入业务逻辑层对象*/
    @Resource
    private ServiceinfoService service;
    @ApiOperation(value = "条件查询")
    @PostMapping("query.do")
    public R query(@RequestBody ServiceSearchBo bo,int page,int size){
        return R.ok(service.queryByCond(page,size,bo));
    }

    @ApiOperation(value = "条件查询修改版")
    @PostMapping("querylist.do")
    public R queryList(@RequestBody ServiceinfoSearchBo bo, int page, int size) {
        return R.ok(service.queryByCond2(page, size, bo));
    }
    /**
    * 新增内容*/
    @ApiOperation(value = "实现新增")
    @PostMapping("save")
    public R save(@RequestBody ServiceinfoAddBo bo){
       return service.save(bo);
    }
    /**
    * 修改内容*/
    @ApiOperation(value = "实现修改")
    @PostMapping("update")
    public R update(@RequestBody ServiceinfoUpdateBo bo){
        return service.update(bo);
    }

    /**
     * 审核*/
    @ApiOperation(value = "实现审核")
    @PostMapping("updateStatus")
    public R updateStatus(int id, int status){
        return service.updateStatus(id, status);
    }

    /**
    * 查询 所有数据*/
    @ApiOperation(value = "实现全部查询")
    @GetMapping("all")
    public R all(){
       return service.queryAll();
    }

    /**
    * 查询 ByID*/
    @ApiOperation(value = "实现查询单个")
    @GetMapping("querydetail")
    public R queryDetail(int sid){
        return service.queryAuditBySId(sid);
    }

    /**
     * 查询 BySID
     * 服务取消，取消记录*/
    @ApiOperation(value = "查询取消详情")
    @GetMapping("querycancel")
    public R queryCancelDetail(int sid){
        return service.queryCancelBySId(sid);
    }

    /**
     * 查询 BySID
     * 服务完成，健康随访记录*/
    @ApiOperation(value = "查询完成详情")
    @GetMapping("queryfinished")
    public R queryFinishedDetail(int sid){
        return service.queryFinishedBySId(sid);
    }
}
